/**
 * 管理当前用户信息的仓库
 */
import { defineStore } from "pinia";

export const userStore = defineStore({
    id: 'user',
    state: () => {
        return {
            account: "JackGrealish",
            total_tokens: 0,
            old_tokens: 0,
            total_tokens_GPT4: 0,
            old_tokens_GPT4: 0,
            level: " ",
        }
    },
    actions: {
        updateAccount(newVal) {
            this.account = newVal
        },
        updateTokens(newVal) {
            this.total_tokens = newVal
        },
        setOldTokens(newVal) {
            this.old_tokens = newVal
        },
        updateLevel(newVal) {
            this.level = newVal
        },
        resetAll() {
            this.account = "JackGrealish"
            this.tokens = 0
            this.level = " "
        }
    },
    getters: {
        getAccount() {
            return this.account
        },
        getTokens() {
            return this.total_tokens
        },
        getLevel() {
            return this.level
        }
    }
})